<template>
  <div id="app">
    <h3>这是Details组件</h3>
    <p v-html="content"></p>
  </div>
</template>

<script>
export default {
  name: "app",
  data() {
    return {
      content: "",
      msg: "Welcome to Your Vue.js App"
    };
  },
  methods: {},
  mounted() {
    var aid = this.$route.params.aid;
    var api ="http://www.phonegap100.com/appapi.php?a=getPortalArticle&aid="+aid;
    this.$http.get(api, { params: { id: 9, name: "hu" } }).then(
      res => {
        console.log(res.body.result[0].content);
        this.content = res.body.result[0].content;
      },
      function(err) {
        console.log(err);
      }
    );
  },
  beforeDestroy() {
    /*页面销毁的时候要保存一些数据，就可以监听这个销毁的生命周期函数*/
    console.log("实例销毁之前");
  },
  destroyed() {
    console.log("实例销毁完成");
  }
};
</script>

<style>
#app {
  font-family: "Avenir", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
